<html>
<head>
<title>test_coos_extend_event</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<script type="text/javascript" src="jsunit/app/jsUnitCore.js"></script>
<script type="text/javascript" src="../coos.js"></script>
<script type="text/javascript">
var es = new Array();
//此函数会在页面加载后首先执行，并且只执行一次，类似于JUnit4中的@BeforeClass注解
function setUpPage()
{
	//e = e || window.event;
	//此行代码必须放置在setUpPage的最后，在完成资源加载后告诉JsUnit该函数已执行完毕
	setUpPageStatus = "complete"; 
}


function setUp() //类比于JUnit中的setUp
{
	e = es[0];
}

function tearDown() //类比于JUnit中的tearDown
{
	//e = null;
}

//function exposeTestFunctionNames() 
//{
//	var tests = new Array(2);
//	tests[0] = "testValidArgs";
//	tests[1] = "testWithNegativeNumbers";
//	return tests;
//}

//test coos.event.add
function testEventAdd()
{
	var el = coos.$id("testEvent");
	coos.event.add(el,"click",callbackTestEvent);
	el.click();
	assertEquals(callbackStr,"callbackTestEvent");
}
var callbackStr = "";
function callbackTestEvent(e)
{
	e = e || window.event;
	es[0] = e;
	callbackStr = "callbackTestEvent";
}

//test coos.event
function testEvent()
{
	var result = coos.event(e);
	assertEquals(e, result);
}

</script>
</head>
<body>
<div id="testEvent">testEvent</div>
</body>
</html>